<?php
$str = "hello world!";
$path = "./uploads/test.txt";

$result = file_put_contents($path, $str);
if ($result) {
  echo "文件写入成功！";
} else {
  echo "文件写入失败";
}
